﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ZX.TR.Bussiness;
using ZX.TR.Library;

namespace ZX.WebApp.TR
{
    public partial class IndagateResultInput : System.Web.UI.Page
    {
        /// <summary>
        /// 窗体加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                DataBinds();
            }
        }

        private void DataBinds()
        {
            BTrSubjectInfo SubjectInfo = new BTrSubjectInfo();
            string id = this.Request.QueryString["id"];
            if (id != "")
            {
                strIndagateId = id;
                V_IndagateList IndagateList = SubjectInfo.GetIndagateByIndagateID(new Guid(id));
                if (IndagateList != null)
                {
                    this.lblType.Text = IndagateList.IndagateType;
                    this.lblTopic.Text = IndagateList.IndagateTopic;
                    this.lblContent.Text = IndagateList.IndagateContent;
                    this.lblAName.Text = IndagateList.ActivityName;
                    this.lblQName.Text = IndagateList.QuestionnaireName;
                    this.lblQaim.Text = IndagateList.QAim;
                    this.txtPoint.Text = IndagateList.GetPoint.ToString();
                    this.txtResult.Text = IndagateList.IndagateSumary;
                    //IList<V_SubjectList> SubList = SubjectInfo.GetSubjectListByQuestionnaireID(new Guid(IndagateList.TrQuestionnaireID.ToString()));
                    IList<V_TrIndagateSubject> Indalist = SubjectInfo.GetVListIndagateSubjectByIndagateID(new Guid(id));
                    if (Indalist != null)
                    {
                        int i = 0;
                        foreach (V_TrIndagateSubject ts in Indalist)
                        {
                            Indalist[i].Point = ts.Point;
                            Indalist[i].Answer = ts.Answer;
                            i++;
                        }
                        this.rpList.DataSource = Indalist;
                        this.rpList.DataBind();
                    }
                }
            }
        }
        public string strIndagateId
        {
            get;
            set;
        }
    }
}